function sum(a, b) {
    console.log(a+b)
    return a + b;
}
var x
var y
var sum1

console.log(k) //报错
console.log(y)// undefined，不会报错

x = 1
y = 1
sum(x, y) // 不会报错
sum1(x,y) //

sum1 = function (a, b) {
    console.log(a+b)
    return a + b
}